<?php echo $header; ?>

<div  class="pathway mgt10">
  <ul>
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <li> <a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
    <?php } ?>
  </ul>
</div>
<style>
.detail-empty-text{
    font-size: 20px;
    font-weight: bold;
    padding: 10px;
    text-align: center;
    text-shadow: 1px 1px #ccc;
}
</style>
<div id="content" class="mgt20">
  <?php if ($thumb || $images) { ?>
  <?php if ($thumb) { ?>
  <div class="des-thumbImg fl"> <a  href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="cloud-zoom" id='zoom1' rel="tint: 'white', position:'right',showTitle:1,titleOpacity:0.5,lensOpacity:0.5,adjustX: 10, adjustY:-4, zoomWidth:360, zoomHeight:390" > <img id="image" src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" style="max-width:360px;max-height:390px;" /> </a> 
    
    <!--<span class="lb-sale1"><b>-<?php echo $saving; ?></b>%</span> -->
    
    <?php if ($images) { ?>
    <div class="image-additional">
      <?php foreach ($images as $image) { ?>
      <a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="cloud-zoom-gallery" rel="useZoom: 'zoom1', smallImage: '<?php echo $image['thumb']; ?>' "> <img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" width="74" height="74"  /> </a>
      <?php } ?>
    </div>
    <?php } ?>
  </div>
  <?php } ?>
  <?php } ?>
  <div class="des-detail-pr fl">
    <h1><?php echo $heading_title; ?></h1>
    <div class="des-detail-w300">
      <div class="des-upby"><?php echo $text_model; ?><strong> <?php echo $model; ?></strong> </div>
      <div class="des-price">
        <p class="clearfix"> <span class="txtw140">Giá bán  :</span> <span class="fl h-stock"><?php echo $stock; ?></span> </p>
        <p class="clearfix mgt10">
          <?php if (!$special) { ?>
          <span class="txtw140 price"> <?php echo $price; ?></span>
          <?php } else { ?>
          <span class="txtw140 price"><?php echo $special; ?></span> <span class="fl cl66 txtout fs14"><?php echo $price; ?></span>
          <?php } ?>
        </p>
        <?php if ($manufacturer) { ?>
        <span class="lbl-bProduct"></span>
        <?php } ?>
      </div>
      <div class="support-totalpay clearfix">
        <div class="order-byphone fl">
		  <p>Phàn nàn về dịch vụ 123Chon.vn:</p>
          <p class="iconsp-mobile fb">0938.456.357 (Mr. Hùng)</p>		  
          <p>Nhân viên bán hàng sỉ&lẻ:</p>
          <p class="iconsp-mobile fb">0938.456.353 </p>
          <p class="iconsp-mobile fb">0975.525.925</p>
          <p><a href="ymsgr:sendim?hotro.123chon" mce_href="ymsgr:sendim?hotro.123chon" border="0"> <img src='http://opi.yahoo.com/online?u=hotro.123chon&m=g&t=2'/> </a></p>
        </div>
        <div class="detail-total fl">
          <p> <span class="lbl-left" style="padding-right:8px;"><?php echo $text_qty; ?></span> <span class="lbl-right" style="line-height:26px;">
            <input type="text" class="fl ipNum" ype="text" name="quantity" value="<?php echo $minimum; ?>" style="width:20px;height:18px;text-align: center;margin-left:0;"/>
            / <span id="max-quantity">15</span>
            <input type="hidden" name="product_id" size="2" value="<?php echo $product_id; ?>" />
            <!--<span class="fl">
                            <a href="javascript:void(0);" class="upNum">&nbsp;</a>
                            <a href="javascript:void(0);" class="downNum">&nbsp;</a>
                        </span>--> 
            </span> </p>
          <!--<p><span class="lbl-left">Thành tiền (*) :</span> <span class="lbl-right fb tien-hang">165.000 đ</span></p>--> 
          
          <!--<?php if ($tax) { ?> <p>
                
        <span class="lbl-left"><?php echo $text_tax; ?></span><span class="lbl-right fb shipping-fee">+<?php echo $tax; ?></span>
       
                <span class="lbl-left">Phí vận chuyển (*) :</span> <span class="lbl-right fb shipping-fee">-</span>
                </p> <?php } ?>--> 
          
          <!--<p><span class="lbl-left">Phí thu tiền tại nhà :</span> <span class="lbl-right fb phi-cod">-</span></p>
                <p><span class="lbl-left">Cần thanh toán :</span> <span class="lbl-right clRed fb tong-tien">165.000 đ</span></p>-->
          
          <div class="frm-slLocal">
            <p class="clearfix">
              <?php if ($options) { ?>
            <div class="options">
              <?php foreach ($options as $option) { ?>
              <?php if ($option['type'] == 'select') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <select style="width:120px;height:28px; padding-left:5px;" name="option[<?php echo $option['product_option_id']; ?>]">
                  <option value=""><?php echo $text_select; ?></option>
                  <?php foreach ($option['option_value'] as $option_value) { ?>
                  <option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
                  <?php if ($option_value['price']) { ?>
                  (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                  <?php } ?>
                  </option>
                  <?php } ?>
                </select>
              </div>
              <br />
              <?php } ?>
              <?php if ($option['type'] == 'radio') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <?php foreach ($option['option_value'] as $option_value) { ?>
                <input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
                <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
                  <?php if ($option_value['price']) { ?>
                  (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                  <?php } ?>
                </label>
                <br />
                <?php } ?>
              </div>
              <br />
              <?php } ?>
              <?php if ($option['type'] == 'checkbox') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <?php foreach ($option['option_value'] as $option_value) { ?>
                <input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
                <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
                  <?php if ($option_value['price']) { ?>
                  (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                  <?php } ?>
                </label>
                <br />
                <?php } ?>
              </div>
              <br />
              <?php } ?>
              <?php if ($option['type'] == 'image') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <table class="option-image">
                  <?php foreach ($option['option_value'] as $option_value) { ?>
                  <tr>
                    <td style="width: 1px;"><input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" /></td>
                    <td><label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><img src="<?php echo $option_value['image']; ?>" alt="<?php echo $option_value['name'] . ($option_value['price'] ? ' ' . $option_value['price_prefix'] . $option_value['price'] : ''); ?>" /></label></td>
                    <td><label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
                        <?php if ($option_value['price']) { ?>
                        (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                        <?php } ?>
                      </label></td>
                  </tr>
                  <?php } ?>
                </table>
              </div>
              <br />
              <?php } ?>
              <?php if ($option['type'] == 'text') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" />
              </div>
              <br />
              <?php } ?>
              <?php if ($option['type'] == 'textarea') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <textarea name="option[<?php echo $option['product_option_id']; ?>]" cols="40" rows="5"><?php echo $option['option_value']; ?></textarea>
              </div>
              <br />
              <?php } ?>
              <?php if ($option['type'] == 'file') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <input type="button" value="<?php echo $button_upload; ?>" id="button-option-<?php echo $option['product_option_id']; ?>" class="button">
                <input type="hidden" name="option[<?php echo $option['product_option_id']; ?>]" value="" />
              </div>
              <br />
              <?php } ?>
              <?php if ($option['type'] == 'date') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="date" />
              </div>
              <br />
              <?php } ?>
              <?php if ($option['type'] == 'datetime') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="datetime" />
              </div>
              <br />
              <?php } ?>
              <?php if ($option['type'] == 'time') { ?>
              <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
                <?php if ($option['required']) { ?>
                <span class="required">*</span>
                <?php } ?>
                <b><?php echo $option['name']; ?>:</b><br />
                <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="time" />
              </div>
              <br />
              <?php } ?>
              <?php } ?>
            </div>
            <?php } ?>
            </p>
          </div>
        </div>
      </div>	  	  <div class="content-information-order">			<?php echo $config_content_order; ?>	  </div>




      <p class="mgt10 fr">
          <a href="tel:+840938456357" style="float: left" id="callnowbutton">0938.456.357</a>
          <a id="button-cart" class="btn-order" style="float: left">&nbsp;</a>
      </p>
      
      <!--<?php 
				
       	$arr='';
        	for ($i=0;$i<strlen($price);$i++){
          	if(is_numeric($price[$i])){
              $arr.=$price[$i];
          	}
        	}
  ?>
<a target="_blank" title="NgânLượng.vn: Hỗ trợ thanh toán trực tuyến AN TOÀN bằng thẻ các ngân hàng trong & ngoài nước; Được bảo hộ & cấp phép bởi NGÂN HÀNG NHÀ NƯỚC VIỆT NAM; Ví điện tử DUY NHẤT được cộng đồng bình chọn ƯA THÍCH NHẤT 2 năm liên tiếp."href="https://www.nganluong.vn/button_payment.php?receiver=nbthu.hd@hotmail.com&product_name=<?php echo $heading_title; ?>&price= <?php echo $arr; ?>&return_url=http:// forbabyvn.com"><img src="https://www.nganluong.vn/data/images/merchant/button/btn-buynow-121.png" border="0"></a>
<br />
<a  style="text-decoration:none; color:#0000FF;" href="http://help.nganluong.vn/ forbabyvn.com.html" title="[hướng dẫn thanh toán]"> [hướng dẫn thanh toán]</a>--> 
      
      <!--<div class="guid-order mgt10" style="display:none;">
            <p>Bạn gặp khó khăn trong việc đặt hàng?</p>
            <p class="mgt10"><a href="#" target="_blank">Hướng dẫn đặt hàng</a></p>
        </div>--> 
    </div>
    <!--end desw300-->
    
    <div class="col250 fr">
      <div class="blockSocial clearfix"> 
        <!-- AddThis Button BEGIN -->
        <div class="addthis_default_style"><a class="addthis_button_compact"><?php echo $text_share; ?></a> <a class="addthis_button_email"></a><a class="addthis_button_print"></a> <a class="addthis_button_facebook"></a> <a class="addthis_button_twitter"></a></div>
        <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script> 
        <!-- AddThis Button END --> 
      </div>
      <!--end social-->
      <div class="blockModule mgt10 saveSeller clearfix">
        <h3>123CHON.VN cam kết bán hàng</h3>
        <ul class="commitment clearfix">
          <li class="iconPay-car clearfix">
            <h4>THANH TOÁN QUA TÀI KHOẢN NGÂN HÀNG</h4>
            <p>Thanh toán qua Agribank, Vietcombank, Đông Á, Eximbank, Techcombank <a href="http://123chon.vn/thong-tin-thanh-toan" target="_blank">Xem chi tiết »</a></p>
          </li>
          <li class="iconShipall clearfix">
            <h4>COD: Nhận hàng và thanh toán tại nhà</h4>
            <p>Bưu điện sẽ phát trong 5-7 ngày làm việc</p>
            <p><a href="http://123chon.vn/COD-nhan-hang-va-thanh-toan-tai-nha" target="_blank">Xem chi tiết »</a></p>
          </li>
          <li class="iconCarebuy clearfix">
            <h4>Cam kết chất lượng và quy định đổi trả hàng</h4>
            <p>Chất lượng cam kết, có thể đổi trả hàng</p>
            <p><a href="http://123chon.vn/quy-dinh-doi-tra-hang" target="_blank">Xem chi tiết »</a></p>
          </li>
        </ul>
      </div>
      <!--end saveseller--> 
    </div>
  </div>
  
  <!--end des-detail-pr-->
  <div class="clearboth"></div>
</div>
<!--end mgt20-->

<div class="col720 fl">
  <div id="tabs" class="htabs"> <a href="#tab-description" style="display: inline;"><?php echo $tab_description; ?></a>
    <?php if ($attribute_groups) { ?>
    <a href="#tab-attribute" style="display: inline;"><?php echo $tab_attribute; ?></a>
    <?php } ?>
    <?php if ($review_status) { ?>
    <a href="#tab-review" style="display: inline;"><?php echo $tab_review; ?></a>
    <?php } ?>
    <!--<?php if ($products) { ?>
    <a href="#tab-related" style="display: inline;"><?php echo $tab_related; ?> (<?php echo count($products); ?>)</a>
    <?php } ?>--> 
  </div>
  <div id="tab-description" class="xtab-content"><?php echo $description; ?></div>
  <?php if ($attribute_groups) { ?>
  <div id="tab-attribute" class="xtab-content">
    <table class="attribute">
      <?php foreach ($attribute_groups as $attribute_group) { ?>
      <thead>
        <tr>
          <td colspan="2"><?php echo $attribute_group['name']; ?></td>
        </tr>
      </thead>
      <tbody>
        <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
        <tr>
          <td><?php echo $attribute['name']; ?></td>
          <td><?php echo $attribute['text']; ?></td>
        </tr>
        <?php } ?>
      </tbody>
      <?php } ?>
    </table>
  </div>
  <?php } ?>
  <?php if ($review_status) { ?>
  <div id="tab-review" class="xtab-content">
    <div id="review"></div>
    <h3 id="review-title"><?php echo $text_write; ?></h3>
    <b><?php echo $entry_name; ?></b><br />
    <input type="text" name="name" value="" />
    <br />
    <b><?php echo $entry_review; ?></b>
    <textarea name="text" cols="40" rows="8" style="width: 98%;"></textarea>
    <span style="font-size: 11px;"><?php echo $text_note; ?></span><br />
    <br />
    <b><?php echo $entry_rating; ?></b> <span><?php echo $entry_bad; ?></span>&nbsp;
    <input type="radio" name="rating" value="1" />
    &nbsp;
    <input type="radio" name="rating" value="2" />
    &nbsp;
    <input type="radio" name="rating" value="3" />
    &nbsp;
    <input type="radio" name="rating" value="4" />
    &nbsp;
    <input type="radio" name="rating" value="5" />
    &nbsp;<span><?php echo $entry_good; ?></span><br />
    <br />
    <b><?php echo $entry_captcha; ?></b><br />
    <input type="text" name="captcha" value="" />
    <br />
    <img src="index.php?route=product/product/captcha" alt="" id="captcha" /><br />
    <br />
    <div class="buttonBl fl" style="margin-left:20px;margin-top:5px"> <a id="button-review" class="btnB-Red sent-cm write-review"><span>Viết đánh giá</span></a> </div>
  </div>
  <?php } ?>
  
  <!--<?php if ($products) { ?>
  <div id="tab-related" class="xtab-content">
    <div class="box-product">
      <?php foreach ($products as $product) { ?>
      <div>
        <?php if ($product['thumb']) { ?>
        <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
        <?php } ?>
        <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
        <?php if ($product['price']) { ?>
        <div class="price">
          <?php if (!$product['special']) { ?>
          <?php echo $product['price']; ?>
          <?php } else { ?>
          <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
          <?php } ?>
        </div>
        <?php } ?>
        <?php if ($product['rating']) { ?>
        <div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
        <?php } ?>
        <a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><?php echo $button_cart; ?></a></div>
      <?php } ?>
    </div>
  </div>
  <?php } ?>-->
  
  <?php if ($tags) { ?>
  <div class="tags"><b><?php echo $text_tags; ?></b>
    <?php for ($i = 0; $i < count($tags); $i++) { ?>
    <?php if ($i < (count($tags) - 1)) { ?>
    <a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>,
    <?php } else { ?>
    <a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>
    <?php } ?>
    <?php } ?>
  </div>
  <?php } ?>
  <?php echo $column_left; ?> <?php echo $column_right; ?> <?php echo $content_top; ?> <?php echo $content_bottom; ?> </div>
<div class="col250 fr">
  <div class="blockModule clearfix mgt20">
    <div class="mod-tile">
      <h4>Có thể bạn quan tâm</h4>
    </div>
    <?php if ($products) { ?>
    <ul class="lst-sameDeal">
      <?php foreach ($products as $product) { ?>
      <li class="clearfix">
        <h3><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?><br/>
          Có Giá <span class="clPrice"> <?php echo $product['price']; ?></span></a></h3>
        <p class="img220">
          <?php if ($product['thumb']) { ?>
          <a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" width="220"  alt="<?php echo $product['name']; ?>" /></a>
          <?php } ?>
        </p>
        <!--<p class="fs11 cl66 "><?php echo $product['name']; ?> </p>
        <div class="fix"></div>
        <?php if (!$product['special']) { ?>
        <p class="">Giá: <span class="clPrice"><?php echo $product['price']; ?></span> &nbsp; &nbsp; </p>
        <?php } else { ?>
        <p> <span class="clPrice"><?php echo $product['special']; ?></span> <span class="txtout cl66 fs11"><?php echo $product['price']; ?></span> </p>
        <?php } ?>-->
      </li>
      <?php } ?>
    </ul>
    <?php } ?>
  </div>
</div>
</div>
<script type="text/javascript"><!--
$('.colorbox').colorbox({
	overlayClose: true,
	opacity: 0.5
});
//--></script> 
<script type="text/javascript"><!--
$('#button-cart').bind('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('.mgt20 input[type=\'text\'], .mgt20 input[type=\'hidden\'], .mgt20 input[type=\'radio\']:checked, .mgt20 input[type=\'checkbox\']:checked, .mgt20 select, .mgt20 textarea'),
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, information, .error').remove();
			
			if (json['error']) {
				if (json['error']['option']) {
					for (i in json['error']['option']) {
						if(!($('#option-' + i).next()[0].tagName === "SPAN")) {						
								$('#option-' + i).after('<span><font color="red">' + json['error']['option'][i] + '</font></span>');
						}
					}
				}
			} 
			
			if (json['success']) {
				if (json['redirect']) {
					location = json['redirect'];
				} 
				$('#notification').html('<div class="recover-success"><div   style="display: none;" class="notify success">' + json['success'] + '</div></div>');
					
				$('.success').fadeIn('slow');
					
				$('#cart-total').html(json['total']);
				
				$('html, body').animate({ scrollTop: 0 }, 'slow'); 
			}	
		}
	});
});
//--></script>
<?php if ($options) { ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/ajaxupload.js"></script>
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'file') { ?>
<script type="text/javascript"><!--
new AjaxUpload('#button-option-<?php echo $option['product_option_id']; ?>', {
	action: 'index.php?route=product/product/upload',
	name: 'file',
	autoSubmit: true,
	responseType: 'json',
	onSubmit: function(file, extension) {
		$('#button-option-<?php echo $option['product_option_id']; ?>').after('<img src="catalog/view/theme/default/image/loading.gif" class="loading" style="padding-left: 5px;" />');
		$('#button-option-<?php echo $option['product_option_id']; ?>').attr('disabled', true);
	},
	onComplete: function(file, json) {
		$('#button-option-<?php echo $option['product_option_id']; ?>').attr('disabled', false);
		
		$('.error').remove();
		
		if (json['success']) {
			alert(json['success']);
			
			$('input[name=\'option[<?php echo $option['product_option_id']; ?>]\']').attr('value', json['file']);
		}
		
		if (json['error']) {
			$('#option-<?php echo $option['product_option_id']; ?>').after('<span class="error">' + json['error'] + '</span>');
		}
		
		$('.loading').remove();	
	}
});
//--></script>
<?php } ?>
<?php } ?>
<?php } ?>
<script type="text/javascript"><!--
$('#review .pagination a').live('click', function() {
	$('#review').fadeOut('slow');
		
	$('#review').load(this.href);
	
	$('#review').fadeIn('slow');
	
	return false;
});			

$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');

$('#button-review').bind('click', function() {
	$.ajax({
		url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
		type: 'post',
		dataType: 'json',
		data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#button-review').attr('disabled', true);
			$('#review-title').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
		},
		complete: function() {
			$('#button-review').attr('disabled', false);
			$('.attention').remove();
		},
		success: function(data) {
			if (data['error']) {
				$('#review-title').after('<div class="warning">' + data['error'] + '</div>');
			}
			
			if (data['success']) {
				$('#review-title').after('<div class="success">' + data['success'] + '</div>');
								
				$('input[name=\'name\']').val('');
				$('textarea[name=\'text\']').val('');
				$('input[name=\'rating\']:checked').attr('checked', '');
				$('input[name=\'captcha\']').val('');
			}
		}
	});
});
//--></script> 
<script type="text/javascript"><!--
$('#tabs a').tabs();
//--></script> 
<script type="text/javascript" src="catalog/view/javascript/jquery/ui/jquery-ui-timepicker-addon.js"></script> 
<script type="text/javascript"><!--
if ($.browser.msie && $.browser.version == 6) {
	$('.date, .datetime, .time').bgIframe();
}

$('.date').datepicker({dateFormat: 'yy-mm-dd'});
$('.datetime').datetimepicker({
	dateFormat: 'yy-mm-dd',
	timeFormat: 'h:m'
});
$('.time').timepicker({timeFormat: 'h:m'});
//--></script> 
<?php echo $footer; ?>
